package clazz.generic;

import com.alibaba.fastjson.JSON;
import entity.PageInfo;
import entity.People;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2021年10月21日 20:45:00
 */
public class GenericDemo {

    /**
     * 泛型方法
     *
     * @param t
     * @return
     */
    public static <T> T getObject(T t) {
        return t;
    }


    public static Class<?> testOne(Class<?> clazz) {
        return clazz;
    }

    public static PageInfoItem getPageInfo(Class<?> clazz) {
        PageInfoItem pageInfoItem = new PageInfoItem();
        PageInfo pageInfo = new PageInfo();
        pageInfoItem.setPageInfo(pageInfo);
        People people = new People();
        people.setAge(12);
        people.setName("张三");
        people.setId(111);
        String str = JSON.toJSONString(people);
        pageInfoItem.setItem(JSON.parseObject(str, clazz));
        return pageInfoItem;
    }


}
